package com.example.luo;

import org.apache.log4j.Level;
import org.apache.log4j.Logger;

/**
 * Created by Administrator on 2017/5/13.
 */

public class LogFactory {
    private static Logger logger;

    static {
        System.out.println("true = " + true);
        ConfigureLog4J configureLog4J = new ConfigureLog4J();
        configureLog4J.configure();

    }

    public static Logger getLogger(String name){
        logger = Logger.getLogger(name);
        logger.setLevel(Level.INFO);
        return logger;
    }

    public static void logE(Level level, String info, Throwable ex) {
        logger.log(level, info, ex);
    }

    public static void log(Level level, String info) {
        logger.log(level, info);
    }

    public static Level getLogLevel() {
        return logger.getLevel();
    }
}
